-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve validation error display #1579
Conversation
I'm aware of the test failures and will fix them soon. |
e68f573
to
25f4c87
Compare
CLI PR: dandi/dandi-cli#1288 |
@jwodder was proactive and prepared a PR for the change in API return values, but I wonder if such change is really needed? Ideally API (or ABI as the schema of returned structures) should not change without a significant reason since it would break prior versions of client(s) etc. |
Previously for asset validation errors, the API returned a flat list of errors (dicts), with no distinction as to which errors belonged to which assets. Since each asset can have more than one error, the format of |
ATM it does feel like that indeed. But in the long run, it might be "too restrictive": an error might relate to multiple assets, or to some entity over assets ("sub-X/ folder is not listed among participants.tsv" in BIDS), etc. Why not to just add |
In the interest of reducing the blast radius from the changes we're making to support better validation error UX, we'll maintain a flat list structure, adding a Your other arguments about restrictiveness point to a different issue, that it is becoming more and more difficult to mediate both the CLI's and web app's needs through a single public API. I have a bold idea here, but I need to think about it a bit more before I share my thoughts (perhaps in a design doc). Stay tuned. |
I would like to hear some of such issues first before we even contemplate a possible redesigns etc. IMHO the proposed here idea of changing the Model (if we think in terms of MVC design pattern) was not really needed/desired regardless either it is for Web or CLI. |
ping: conflicts |
The object maps asset paths to their corresponding errors
66a073b
to
5aeacc3
Compare
@mvandenburgh @marySalvi This PR is ready for review. |
@AlmightyYakob Please summarize the changes to the API that this PR currently makes. |
The only API change is that now the objects in the |
def inject_path(asset: dict, err: dict): | ||
return {**err, 'path': asset['path']} | ||
|
||
# Aggregate errors, ensuring the path of the asset is included | ||
errors = [] | ||
for asset in invalid_assets: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will be really slow and/or memory intensive if a dandiset has hundreds of thousands of invalid assets. In general, I don't like how we go about storing asset validation errors in the database, but this PR is a strict improvement over the current situation imo. Perhaps related to #1214.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
🚀 PR was released in |
This displays validation errors in a modal, instead of a small menu next to the sidebar. The version metadata validation errors remain largely unchanged. The asset validation errors have been improved to both display the path of the asset, as well as group the errors of an asset, if an asset contains multiple errors.
This is how it looks now: